import { Address } from '../../utils/address.js';
import { My } from '../my/my-model.js';

var address = new Address();
var my = new My();

Page({
  data: {
    pageIndex: 1,
    addressInfo: null
  },
  onLoad: function () {
    this._getAddressInfo();
  },

  /**地址信息**/
  _getAddressInfo: function () {
    var that = this;
    address.getAddress((addressInfo) => {
      that._bindAddressInfo(addressInfo);
    });
  },
  
  /*绑定地址信息*/
  _bindAddressInfo: function (addressInfo) {
    this.setData({
      addressInfo: addressInfo
    });
  },

  jump: function (event) {
    var id = my.getDataSet(event, 'id');  //传给下一层
    if(id!=8){
      wx.navigateTo({
        url: '../wait/wait?id=' + id + '&&type=1'
      })
    }else{
      wx.navigateTo({
        url: '../wait/wait?id=' + 0 + '&&type=2'
      })
    }
  }
})